﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace URLChannelTester
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            var file = new FileInfo("C:\\Log\\URLTEST.url.log");

            file.Delete();
            UrlCrawler urlCrawler = new UrlCrawler(txtFilePath.Text);
            urlCrawler.DoWork();
            MessageBox.Show("xong rồi !!!");

        }

        private void btnFile_Click(object sender, EventArgs e)
        {
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                txtFilePath.Text = openFileDialog.FileName;
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {

           
            try
            {
                TextReader r = new FileInfo("C:\\Log\\URLTEST.url.log").OpenText();
                var content = r.ReadToEnd();
                r.Close();
                txtRet.Text = content;
            }
            catch (Exception ex)
            {
                MessageBox.Show("kiểm tra lại ko có url nhé!!!!");
            }



        }
    }
}
